\documentclass[letterpaper]{article}
\usepackage{common/ohpc-doc}
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}

% Include git variables
\input{vc.tex}

% Define Base OS and other local macros
\newcommand{\baseOS}{CentOS7.7}
\newcommand{\OSRepo}{CentOS\_7.7}
\newcommand{\OSTree}{CentOS\_7}
\newcommand{\OSTag}{el7}
\newcommand{\baseos}{centos7.7}
\newcommand{\baseosshort}{centos7}
\newcommand{\provisioner}{Warewulf}
\newcommand{\provheader}{\provisioner{}}
\newcommand{\rms}{PBS Professional}
\newcommand{\rmsshort}{pbspro}
\newcommand{\arch}{aarch64}

% Define package manager commands
\newcommand{\pkgmgr}{yum}
\newcommand{\addrepo}{wget -P /etc/yum.repos.d}
\newcommand{\chrootaddrepo}{wget -P \$CHROOT/etc/yum.repos.d}
\newcommand{\clean}{yum clean expire-cache}
\newcommand{\chrootclean}{yum --installroot=\$CHROOT clean expire-cache}
\newcommand{\install}{yum -y install}
\newcommand{\chrootinstall}{yum -y --installroot=\$CHROOT install}
\newcommand{\groupinstall}{yum -y groupinstall}
\newcommand{\groupchrootinstall}{yum -y --installroot=\$CHROOT groupinstall}
\newcommand{\remove}{yum -y remove}
\newcommand{\upgrade}{yum -y upgrade}
\newcommand{\chrootupgrade}{yum -y --installroot=\$CHROOT upgrade}
\newcommand{\tftppkg}{syslinux-tftpboot}

% boolean for os-specific formatting
\toggletrue{isaarch}
\toggletrue{isCentOS}
\toggletrue{isCentOS_ww_pbs_aarch}
\toggletrue{ispbs}
\toggletrue{isWarewulf}

\begin{document}
\graphicspath{{common/figures/}}
\thispagestyle{empty}

% Title Page --------------------------------------------------------
\input{common/title}
% Disclaimer
\input{common/legal} 

\newpage
\tableofcontents
\newpage

% Introduction  ----------------------------------------------------


\section{Introduction} \label{sec:introduction}
\input{common/install_header}
\input{common/intro} \\

\input{common/base_edition/edition}
\input{common/audience}
\input{common/requirements}
\input{common/inputs}

% begin_ohpc_run
% ohpc_validation_newline
% ohpc_validation_comment Verify OpenHPC repository has been enabled before proceeding
% ohpc_validation_newline
% ohpc_command yum repolist | grep -q OpenHPC
% ohpc_command if [ $? -ne 0 ];then
% ohpc_command    echo "Error: OpenHPC repository must be enabled locally"
% ohpc_command    exit 1
% ohpc_command fi
% end_ohpc_run

% Base Operating System --------------------------------------------

\section{Install Base Operating System (BOS)}
\input{common/bos}

% begin_ohpc_run
% ohpc_validation_newline
% ohpc_validation_comment Disable firewall 
\begin{lstlisting}[language=bash,keywords={}]
[sms](*\#*) systemctl disable firewalld
[sms](*\#*) systemctl stop firewalld
\end{lstlisting}
% end_ohpc_run

% ------------------------------------------------------------------

\section{Install \OHPC{} Components} \label{sec:basic_install}
\input{common/install_ohpc_components_intro.tex}

\subsection{Enable \OHPC{} repository for local use} \label{sec:enable_repo}
\input{common/enable_ohpc_repo}

In addition to the \OHPC{} package repository, the {\em master} host also
requires access to the standard base OS distro repositories in order to resolve
necessary dependencies. For \baseOS{}, the requirements are to have access to
both the base OS and EPEL repositories for which mirrors are freely available online:

\begin{itemize*}
\item CentOS-7 - Base 7.7.1908
  (e.g. \href{http://mirror.centos.org/altarch/7.7.1908/os/aarch64/}
  {\color{blue}{http://mirror.centos.org/altarch/7.7.1908/os/aarch64/}} )
  \item EPEL 7
    (e.g. \href{http://download.fedoraproject.org/pub/epel/7/aarch64}
                            {\color{blue}{http://download.fedoraproject.org/pub/epel/7/aarch64}})
\end{itemize*}

\input{common/automation}

\subsection{Add provisioning services on {\em master} node} \label{sec:add_provisioning}
\input{common/install_provisioning_intro}
\input{common/enable_pxe}
\input{common/time}

\subsection{Add resource management services on {\em master} node} \label{sec:add_rm}
\input{common/install_pbspro}

%% Add if/when IB is available for testing
%% \subsection{Optionally add \InfiniBand{} support services on {\em master} node} \label{sec:add_ofed}
%% \input{common/ibsupport_sms_centos}

%\vspace*{-0.15cm}
\subsection{Complete basic Warewulf setup for {\em master} node} \label{sec:setup_ww}
\input{common/warewulf_setup}
\input{common/warewulf_setup_centos}

\subsection{Define {\em compute} image for provisioning}
\input{common/warewulf_mkchroot_centos}

\subsubsection{Add \OHPC{} components} \label{sec:add_components}
\input{common/add_to_compute_chroot_intro}

% begin_ohpc_run
% ohpc_validation_comment Add OpenHPC components to compute instance
\begin{lstlisting}[language=bash,literate={-}{-}1,keywords={},upquote=true]
# Add PBS Professional client support
[sms](*\#*) (*\chrootinstall*) pbspro-execution-ohpc
[sms](*\#*) perl -pi -e "s/PBS_SERVER=\S+/PBS_SERVER=${sms_name}/" $CHROOT/etc/pbs.conf
[sms](*\#*) echo "PBS_LEAF_NAME=${sms_name}" >> /etc/pbs.conf
[sms](*\#*) chroot $CHROOT opt/pbs/libexec/pbs_habitat
[sms](*\#*) perl -pi -e "s/\$clienthost \S+/\$clienthost ${sms_name}/" $CHROOT/var/spool/pbs/mom_priv/config
[sms](*\#*) echo "\$usecp *:/home /home" >> $CHROOT/var/spool/pbs/mom_priv/config
[sms](*\#*) chroot $CHROOT systemctl enable pbs

# Add Network Time Protocol (NTP) support
[sms](*\#*) (*\chrootinstall*) ntp

# Add kernel drivers
[sms](*\#*) (*\chrootinstall*) kernel

# Include modules user environment
[sms](*\#*) (*\chrootinstall*) lmod-ohpc
\end{lstlisting}
% end_ohpc_run

\subsubsection{Customize system configuration} \label{sec:master_customization}
\input{common/warewulf_chroot_customize_centos}

%\clearpage
\subsubsection{Additional Customization ({\em optional})} \label{sec:addl_customizations}
\input{common/compute_customizations_intro}

%% Add if/when IB is available for testing
%% \paragraph{Increase locked memory limits}
%% \input{common/memlimits}

%%\paragraph{Add \Lustre{} client} \label{sec:lustre_client}
%%\input{common/lustre-client}
%%\input{common/lustre-client-centos}
%%\vspace*{0.5cm}
%%\input{common/lustre-client-post}

%\clearpage
\vspace*{-.2cm}
\paragraph{Enable forwarding of system logs} \label{sec:add_syslog}
\input{common/syslog}

\vspace*{-.2cm}
\paragraph{Add \Nagios{} monitoring}
\input{common/nagios}

%\clearpage
\vspace*{-.2cm}
\paragraph{Add \Ganglia{} monitoring}
\input{common/ganglia}

\paragraph{Add \clustershell{}}
\input{common/clustershell}

%\clearpage
%\paragraph{Add \mrsh{}}
%\input{common/mrsh}

\vspace*{-.2cm}
\paragraph{Add \genders{}}
\input{common/genders}

\vspace*{-.2cm}
\paragraph{Add \conman{}} \label{sec:add_conman}
\input{common/conman}

\paragraph{Add \nhc{}} \label{sec:add_nhc}
\input{common/nhc}

\vspace*{-.2cm}
\subsubsection{Import files} \label{sec:file_import}
\input{common/import_ww_files}
%% \input{common/import_ww_files_ib_centos}
\vspace*{-.3cm}
\input{common/finalize_provisioning}
\input{common/add_ww_hosts_intro}
\input{common/add_ww_hosts_pbs}
\input{common/add_ww_hosts_finalize}

\vspace*{-0.2cm}
\subsubsection{Optional kernel arguments} \label{sec:optional_kargs}
\input{common/conman_post}
\input{common/kargs_post}

\vspace*{-0.2cm}
\subsubsection{Optionally configure stateful provisioning}
\input{common/stateful}

\vspace*{-0.1cm}
\subsection{Boot compute nodes} \label{sec:boot_computes}
\input{common/reset_computes} 

\vspace*{-0.50cm}
\section{Install \OHPC{} Development Components} \label{sec:install_dev}
\input{common/dev_intro.tex}

\vspace*{-0.15cm}
\subsection{Development Tools} \label{sec:install_dev_tools}
\input{common/dev_tools}

\vspace*{-0.15cm}
\subsection{Compilers} \label{sec:install_compilers}
\input{common/compilers}

%\clearpage
\subsection{MPI Stacks} \label{sec:mpi}
\input{common/mpi_aarch}

\subsection{Performance Tools} \label{sec:install_perf_tools}
\input{common/perf_tools}

\subsection{Setup default development environment}
\input{common/default_dev}

%\vspace*{0.2cm}
\subsection{3rd Party Libraries and Tools} \label{sec:3rdparty}
\input{common/third_party_libs_intro}
\input{common/third_party_libs_petsc_centos}
\input{common/third_party_libs}
\input{common/third_party_mpi_libs_aarch}

\clearpage
\section{Resource Manager Startup} \label{sec:rms_startup}
\input{common/pbspro_startup}

\section{Run a Test Job} \label{sec:test_job}
\input{common/pbspro_test_job}

\clearpage
\appendix
{\bf \LARGE \centerline{Appendices}} \vspace*{0.2cm}

\addcontentsline{toc}{section}{Appendices}
\renewcommand{\thesubsection}{\Alph{subsection}}

\input{common/automation_appendix}
\input{common/upgrade}
\input{common/test_suite}
\input{common/customization_appendix_centos}
\input{manifest}
\input{common/signature}


\end{document}

